module WWW
  class Tkd
    class GwtExpress
      #检查是否具备新的快递信息
      def self.has_newer_express tb_user,user_id,app_instance_id,hash_code,is_seller
        #安全校验
        if !WWW::Tkd::Utils::Misc.validate_parameter user_id,app_instance_id,hash_code,is_seller
          return nil
        end
        if is_seller
          return WWW::Tkd::TbSellerOrder.count_by_sql(["select count(id) from tb_seller_orders where user_id = ? and is_newer=1", tb_user.id])>0
        else
          return WWW::Tkd::TbBuyerOrder.count_by_sql(["select count(id) from tb_buyer_orders where user_id = ? and is_newer=1", tb_user.id])>0
        end
      end
      #获得最新快递信息
      def self.get_newer_express tb_user,user_id,app_instance_id,hash_code,is_seller
        #安全校验
        if !WWW::Tkd::Utils::Misc.validate_parameter user_id,app_instance_id,hash_code,is_seller
          return nil
        end
        if is_seller
          return WWW::Tkd::TbSellerOrder.count_by_sql(["select count(id) from tb_seller_orders where user_id = ? and is_newer=1", tb_user.id])>0
        else
          return WWW::Tkd::TbBuyerOrder.count_by_sql(["select count(id) from tb_buyer_orders where user_id = ? and is_newer=1", tb_user.id])>0
        end
      end
    end
  end
end
